package com.androidx.p013lv.invention.adapter;

import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import com.androidx.p013lv.base.bean.VarietyBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.invention.C1069R;
import com.yalantis.ucrop.view.CropImageView;
import com.youth.banner.adapter.BannerAdapter;
import java.util.List;

/* renamed from: com.androidx.lv.invention.adapter.VarietyAdapter */
public class VarietyAdapter extends BannerAdapter<VarietyBean, Holder> {
    String domain;
    Fragment fragment;
    private int selectPosition;

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public /* bridge */ /* synthetic */ void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i, List list) {
        onBindViewHolder((Holder) viewHolder, i, (List<Object>) list);
    }

    public void setSelectPosition(int i) {
        this.selectPosition = i;
        for (int i2 = 0; i2 < getItemCount(); i2++) {
            notifyItemChanged(i2, "select");
        }
    }

    public VarietyAdapter(List<VarietyBean> list, String str, Fragment fragment2) {
        super(list);
        this.domain = str;
        this.fragment = fragment2;
    }

    public String getDomain() {
        return this.domain;
    }

    public VarietyBean getDataInPosition(int i) {
        return (VarietyBean) this.mDatas.get(i);
    }

    @Override // com.youth.banner.adapter.IViewHolder
    public Holder onCreateHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(C1069R.C1074layout.item_variety_banner, viewGroup, false));
    }

    public void onBindViewHolder(Holder holder, int i, List<Object> list) {
        if (list.isEmpty()) {
            onBindViewHolder(holder, i);
        } else {
            holder.setItemData(i);
        }
    }

    public void onBindView(Holder holder, VarietyBean varietyBean, int i, int i2) {
        holder.setData(varietyBean, i);
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.androidx.lv.invention.adapter.VarietyAdapter$Holder */
    public class Holder extends RecyclerView.ViewHolder {
        View highlight_view;
        ImageView iv_cover;
        TextView tv_video_num;
        TextView tv_video_replace;

        public Holder(View view) {
            super(view);
            this.iv_cover = (ImageView) view.findViewById(C1069R.C1072id.iv_cover);
            this.tv_video_num = (TextView) view.findViewById(C1069R.C1072id.tv_video_num);
            this.tv_video_replace = (TextView) view.findViewById(C1069R.C1072id.tv_video_replace);
            this.highlight_view = view.findViewById(C1069R.C1072id.highlight_view);
        }

        public void setData(VarietyBean varietyBean, int i) {
            if (TextUtils.isEmpty(varietyBean.getCoverImg())) {
                GlideUtils.loadCropRadiusDefault(VarietyAdapter.this.fragment, 4, this.iv_cover);
            } else {
                Fragment fragment = VarietyAdapter.this.fragment;
                GlideUtils.loadCropRadiusWh2(fragment, VarietyAdapter.this.domain + varietyBean.getStationImg(), 4, this.iv_cover, CropImageView.DEFAULT_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION);
            }
            if (varietyBean.getNewVideoNum() > 0) {
                TextView textView = this.tv_video_num;
                textView.setText(varietyBean.getNewVideoNum() + "");
                this.tv_video_replace.setVisibility(0);
            } else {
                this.tv_video_num.setText("");
                this.tv_video_replace.setVisibility(8);
            }
            if (VarietyAdapter.this.selectPosition == i) {
                this.highlight_view.setVisibility(8);
            } else {
                this.highlight_view.setVisibility(0);
            }
        }

        /* access modifiers changed from: package-private */
        public void setItemData(int i) {
            if (VarietyAdapter.this.selectPosition + 1 == i) {
                this.highlight_view.setVisibility(8);
            } else {
                this.highlight_view.setVisibility(0);
            }
        }
    }
}
